package org.devocean.groupbuying.domain;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
import org.hibernate.annotations.GenericGenerator;

@SuppressWarnings("unused")
@Entity
public class SerialKey {

	@Id
	@GeneratedValue
	private Integer serialKeyID;
	private String serial;
	private Boolean valid = true;
	private Date useDate;
	private Boolean used;

	@ManyToOne
	@JoinColumn(name = "voucherID", referencedColumnName = "voucherID", nullable = false)
	private Voucher voucher;
	
	
	@ManyToOne
	private PurchaseItem item;

	public SerialKey() {
		// TODO Auto-generated constructor stub
	}

	public SerialKey(String serial, Boolean valid, Voucher voucher) {
		super();
		this.serial = serial;
		this.valid = valid;
		this.voucher = voucher;
	}

	public SerialKey(String serial, Boolean valid) {
		super();
		this.serial = serial;
		this.valid = valid;
	}

	public String getSerial() {
		return serial;
	}

	public void setSerial(String serial) {
		this.serial = serial;
	}

	public Boolean getValid() {
		return valid;
	}

	public void setValid(Boolean valid) {
		this.valid = valid;
	}

	public Voucher getVoucher() {
		return voucher;
	}

	public void setVoucher(Voucher voucher) {
		this.voucher = voucher;
	}
	

	public Integer getSerialKeyID() {
		return serialKeyID;
	}

	public void setSerialKeyID(Integer serialKeyID) {
		this.serialKeyID = serialKeyID;
	}

	public Date getUseDate() {
		return useDate;
	}

	public void setUseDate(Date useDate) {
		this.useDate = useDate;
	}

	public Boolean getUsed() {
		return used;
	}

	public void setUsed(Boolean used) {
		this.used = used;
	}

	public PurchaseItem getItem() {
		return item;
	}

	public void setItem(PurchaseItem item) {
		this.item = item;
	}

	public String toString() {
		return "SerialKey [serialKeyID=" + serialKeyID + ", serial=" + serial
				+ ", valid=" + valid + "]";
	}

}
